home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / fragrouter / Libnet-0.99b / src / stubs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-07-26  |  9.0 KB  |  384 lines

  1. /*
  2.  *  $Id: stubs.c,v 1.2 1999/05/27 02:32:19 dugsong Exp $
  3.  *
  4.  *  libnet
  5.  *  stubs.c - planned function cohesion renaming scheme stubs
  6.  *
  7.  *  Copyright (c) 1998, 1999 Mike D. Schiffman <mike@infonexus.com>
  8.  *                           route|daemon9 <route@infonexus.com>
  9.  *  All rights reserved.
  10.  *
  11.  * Redistribution and use in source and binary forms, with or without
  12.  * modification, are permitted provided that the following conditions
  13.  * are met:
  14.  * 1. Redistributions of source code must retain the above copyright
  15.  *    notice, this list of conditions and the following disclaimer.
  16.  * 2. Redistributions in binary form must reproduce the above copyright
  17.  *    notice, this list of conditions and the following disclaimer in the
  18.  *    documentation and/or other materials provided with the distribution.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  21.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  24.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30.  * SUCH DAMAGE.
  31.  *
  32.  */
  33.  
  34. #if (HAVE_CONFIG_H)
  35. #include "../include/config.h"
  36. #endif
  37. #include "../include/libnet.h"
  38.  
  39. int
  40. libnet_init_packet(size_t p_size, u_char **buf)
  41. {
  42.     return (init_packet(p_size, buf));
  43. }
  44.  
  45.  
  46. void
  47. libnet_destroy_packet(u_char **buf)
  48. {
  49.     destroy_packet(buf);
  50. }
  51.  
  52.  
  53. int
  54. libnet_init_packet_arena(struct libnet_arena **arena, u_short p_num, 
  55.         u_short p_size)
  56. {
  57.     return (init_packet_arena(arena, p_num, p_size));
  58. }
  59.  
  60.  
  61. u_char *
  62. libnet_next_packet_from_arena(struct libnet_arena **arena, u_short p_size)
  63. {
  64.     return (next_packet_from_arena(arena, p_size));
  65. }
  66.  
  67.  
  68. void
  69. libnet_destroy_packet_arena(struct libnet_arena **arena)
  70. {
  71.     destroy_packet_arena(arena);
  72. }
  73.  
  74.  
  75. u_char *
  76. libnet_host_lookup(u_long in, u_short use_name)
  77. {
  78.     return (host_lookup(in, use_name));
  79. }
  80.  
  81.  
  82. void
  83. libnet_host_lookup_r(u_long in, u_short use_name, u_char *buf)
  84. {
  85.     host_lookup_r(in, use_name, buf);
  86. }
  87.  
  88.  
  89. u_long
  90. libnet_name_resolve(u_char *hostname, u_short use_name)
  91. {
  92.     return (name_resolve(hostname, use_name));
  93. }
  94.  
  95.  
  96. u_long
  97. libnet_get_ipaddr(struct link_int *l, const u_char *device, u_char *buf)
  98. {
  99.     return (get_ipaddr(l, (const u_char *)device, buf));
  100. }
  101.  
  102.  
  103. struct ether_addr *
  104. libnet_get_hwaddr(struct link_int *l, const u_char *device, u_char *buf)
  105. {
  106.     return (get_hwaddr(l, (const u_char *)device, buf));
  107. }
  108.  
  109.        
  110. int
  111. libnet_open_raw_sock(int protocol)
  112. {
  113.     return (open_raw_sock(protocol));
  114. }
  115.  
  116.  
  117. int
  118. libnet_close_raw_sock(int fd)
  119. {
  120.     return (close_raw_sock(fd));
  121. }
  122.  
  123.  
  124. struct link_int *
  125. libnet_open_link_interface(char *device, char *ebuf)
  126. {
  127.     return (open_link_interface(device, ebuf));
  128. }
  129.  
  130.  
  131. int
  132. libnet_close_link_interface(struct link_int *l)
  133. {
  134.     return (close_link_interface(l));
  135. }
  136.  
  137.  
  138. int
  139. libnet_write_ip(int sock, u_char *packet, int len)
  140. {
  141.     return (write_ip(sock, packet, len));
  142. }
  143.        
  144.  
  145. int
  146. libnet_write_link_layer(struct link_int *l, const u_char *device, u_char *buf,
  147.         int len)
  148. {
  149.     return (write_link_layer(l, (const u_char *)device, buf, len));
  150. }
  151.        
  152.  
  153. int
  154. libnet_do_checksum(u_char *buf, int protocol, int len)
  155. {
  156.     return (do_checksum(buf, protocol, len));
  157. }
  158.  
  159.  
  160. u_short
  161. libnet_ip_check(u_short *buf, int len)
  162. {
  163.     return (libnet_ip_check(buf, len));
  164. }
  165.  
  166.  
  167. void
  168. libnet_build_arp(u_short hrd, u_short pro, u_char hln, u_char pln,
  169.         u_short op, u_char *sha, u_char *spa, u_char *tha, u_char *tpa,
  170.         const u_char *payload, int payload_s, u_char *buf)
  171. {
  172.     build_arp(hrd, pro, hln, pln, op, sha, spa, tha, tpa, payload, payload_s,
  173.         buf);
  174. }
  175.  
  176.  
  177. void
  178. libnet_build_dns(u_short id, u_short flags, u_short num_q, u_short num_anws_rr,
  179.         u_short num_auth_rr, u_short num_addi_rr, const u_char *payload,
  180.         int payload_s, u_char *buf)
  181. {
  182.     build_dns(id, flags, num_q, num_anws_rr, num_auth_rr, num_addi_rr, payload,
  183.         payload_s, buf);
  184. }
  185.  
  186.  
  187. void
  188. libnet_build_ethernet(u_char *daddr, u_char *saddr, u_short id,
  189.         const u_char *payload, int payload_s, u_char *buf)
  190. {
  191.     build_ethernet(daddr, saddr, id, payload, payload_s, buf);
  192. }
  193.  
  194.  
  195. void
  196. libnet_build_icmp_echo(u_char type, u_char code, u_short id, u_short seq,
  197.         const u_char *payload, int payload_s, u_char *buf)
  198. {
  199.     build_icmp_echo(type, code, id, seq, payload, payload_s, buf);
  200. }
  201.  
  202.  
  203. void
  204. libnet_build_icmp_mask(u_char type, u_char code, u_short id, u_short seq,
  205.         u_long mask, const u_char *payload, int payload_s, u_char *buf)
  206. {
  207.     build_icmp_mask(type, code, id, seq, mask, payload, payload_s, buf);
  208. }
  209.  
  210.  
  211. void
  212. libnet_build_icmp_unreach(u_char type, u_char code, u_short orig_len,
  213.         u_char orig_tos, u_short orig_id, u_short orig_frag, u_char orig_ttl,
  214.         u_char orig_prot, u_long orig_src, u_long orig_dst,
  215.         const u_char *orig_payload, int payload_s, u_char *buf)
  216. {
  217.     build_icmp_unreach(type, code, orig_len, orig_tos, orig_id, orig_frag,
  218.         orig_ttl, orig_prot, orig_src, orig_dst, orig_payload, payload_s, buf);
  219. }
  220.        
  221.  
  222. void
  223. libnet_build_icmp_timeexceed(u_char type, u_char code, u_short orig_len,
  224.         u_char orig_tos, u_short orig_id, u_short orig_frag, u_char orig_ttl,
  225.         u_char orig_prot, u_long orig_src, u_long orig_dst,
  226.         const u_char *orig_payload, int payload_s, u_char *buf)
  227. {
  228.     build_icmp_timeexceed(type, code, orig_len, orig_tos, orig_id, orig_frag,
  229.         orig_ttl, orig_prot, orig_src, orig_dst, orig_payload, payload_s, buf);
  230. }
  231.  
  232.  
  233. void
  234. libnet_build_icmp_timestamp(u_char type, u_char code, u_short id, u_short seq,
  235.         n_time otime, n_time rtime, n_time ttime, const u_char *payload,
  236.         int payload_s, u_char *buf)
  237. {
  238.     build_icmp_timestamp(type, code, id, seq, otime, rtime, ttime, payload,
  239.         payload_s, buf);
  240. }
  241.  
  242.  
  243. void
  244. libnet_build_igmp(u_char type, u_char code, u_long ip, u_char *buf)
  245. {
  246.     build_igmp(type, code, ip, buf);
  247. }
  248.  
  249.  
  250. void
  251. libnet_build_ip(u_short len, u_char tos, u_short id, u_short frag, u_char ttl,
  252.         u_char prot, u_long saddr, u_long daddr, const u_char *payload,
  253.         int payload_s, u_char *buf)
  254. {
  255.     build_ip(len, tos, id, frag, ttl, prot, saddr, daddr, payload, payload_s,
  256.         buf);
  257. }
  258.  
  259.  
  260. void
  261. libnet_build_rip(u_char command, u_char ver, u_short rd, u_short af,
  262.         u_short rt, u_long addr, u_long mask, u_long next_hop, u_long metric,
  263.         const u_char *payload, int payload_s, u_char *buf)
  264. {
  265.     build_rip(command, ver, rd, af, rt, addr, mask, next_hop, metric, payload,
  266.         payload_s, buf);
  267. }
  268.  
  269.  
  270. void
  271. libnet_build_tcp(u_short sport, u_short dport, u_long seq, u_long ack,
  272.         u_char control, u_short win, u_short urg, const u_char *payload,
  273.         int payload_s, u_char *buf)
  274. {
  275.     build_tcp(sport, dport, seq, ack, control, win, urg, payload, payload_s,
  276.         buf);
  277. }
  278.  
  279.  
  280. void
  281. libnet_build_udp(u_short sport, u_short dport, const u_char *payload,
  282.                    int payload_s, u_char *buf)
  283. {
  284.     build_udp(sport, dport,payload, payload_s, buf);
  285. }
  286.  
  287.  
  288. int
  289. libnet_insert_ipo(struct ipoption *opt, u_char opt_len, u_char *buf)
  290. {
  291.     return (insert_ipo(opt, opt_len, buf));
  292. }
  293.  
  294.  
  295. int
  296. libnet_insert_tcpo(struct tcpoption *opt, u_char opt_len, u_char *buf)
  297. {
  298.     return (insert_tcpo(opt, opt_len, buf));
  299. }
  300.  
  301.  
  302. int
  303. libnet_seed_prand()
  304. {
  305.     return (seed_prand());
  306. }
  307.  
  308.  
  309. u_long
  310. libnet_get_prand(int type)
  311. {
  312.     return (get_prand(type));
  313. }
  314.  
  315.  
  316. u_char *
  317. libnet_build_asn1_int(u_char *data, int *datalen, u_char type, long *int_p,
  318.         int int_s)
  319. {
  320.     return (build_asn1_int(data, datalen, type, int_p, int_s));
  321. }
  322.  
  323.  
  324. u_char *
  325. libnet_build_asn1_uint(u_char *data, int *datalen, u_char type, u_long *int_p,
  326.         int int_s)
  327. {
  328.     return (build_asn1_uint(data, datalen, type, int_p, int_s));
  329. }
  330.  
  331.  
  332. u_char *
  333. libnet_build_asn1_string(u_char *data, int *datalen, u_char type,
  334.     u_char *string, int str_s)
  335. {
  336.     return (build_asn1_string(data, datalen, type, string, str_s));
  337. }
  338.  
  339.  
  340. u_char *
  341. libnet_build_asn1_header(u_char *data, int *datalen, u_char type, int len)
  342. {
  343.     return (build_asn1_header(data, datalen, type, len));
  344. }
  345.  
  346.  
  347. u_char *
  348. libnet_build_asn1_length(u_char *data, int *datalen, int len)
  349. {
  350.     return (build_asn1_length(data, datalen, len));
  351. }
  352.  
  353.  
  354. u_char *
  355. libnet_build_asn1_sequence(u_char *data, int *datalen, u_char type, int len)
  356. {
  357.     return (build_asn1_sequence(data, datalen, type, len));
  358. }
  359.  
  360.  
  361. u_char *
  362. libnet_build_asn1_objid(u_char *data, int *datalen, u_char type, oid *objid,
  363.         int oid_s)
  364. {
  365.     return (build_asn1_objid(data, datalen, type, objid, oid_s));
  366. }
  367.  
  368.  
  369. u_char *
  370. libnet_build_asn1_null(u_char *data, int *datalen, u_char type)
  371. {
  372.     return (build_asn1_null(data, datalen, type));
  373. }
  374.  
  375.  
  376. u_char *
  377. libnet_build_asn1_bitstring(u_char *data, int *datalen, u_char type,
  378.         u_char *string, int str_s)
  379. {
  380.     return (build_asn1_bitstring(data, datalen, type, string, str_s));
  381. }
  382.  
  383. /* EOF */
  384.